package cn.sjj.util;

import java.io.FileDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class ClassUtil {
	
	public static Class myGetClass(String name) throws ClassNotFoundException {
		Class clazz = Class.forName(name);
		return clazz;
	}
	
	public static Method myGetMethod(Class clazz, String name, Class... params) throws NoSuchMethodException {
		Method method = clazz.getMethod(name, params);
		return method;
	}
	
	public static Field myGetFeild(Class clazz, String name) throws NoSuchFieldException {
		Field field = clazz.getField(name);
		return field;
	}
	
	public static Field myGetDeclaredField(Class clazz, String name) throws NoSuchFieldException {
		Field field = clazz.getDeclaredField(name);
		field.setAccessible(true);
		return field;
	}

	public static int myGetFieldValueInt(Field field, Object object) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
		int int1 = field.getInt(object);
		return int1;
	}
}
